OSDN Git Service

am 22976122: Record device screen state and system load (from /proc/loadavg).
[android-x86/system-extras.git] / ext4_utils / ext4_utils.c
1 /*
2  * Copyright (C) 2010 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #include "ext4_utils.h"
18 #include "allocate.h"
19 #include "indirect.h"
20 #include "extent.h"
21 #include "sha1.h"
22
23 #include <sparse/sparse.h>
24 #ifdef REAL_UUID
25 #include <uuid.h>
26 #endif
27
28 #include <fcntl.h>
29 #include <inttypes.h>
30 #include <sys/stat.h>
31 #include <sys/types.h>
32 #include <stddef.h>
33 #include <string.h>
34
35 #ifdef USE_MINGW
36 #include <winsock2.h>
37 #else
38 #include <arpa/inet.h>
39 #include <sys/ioctl.h>
40 #endif
41
42 #if defined(__linux__)
43 #include <linux/fs.h>
44 #elif defined(__APPLE__) && defined(__MACH__)
45 #include <sys/disk.h>
46 #endif
47
48 int force = 0;
49 struct fs_info info;
50 struct fs_aux_info aux_info;
51 struct sparse_file *ext4_sparse_file;
52
53 jmp_buf setjmp_env;
54
55 /* Definition from RFC-4122 */
56 struct uuid {
57     u32 time_low;
58     u16 time_mid;
59     u16 time_hi_and_version;
60     u8 clk_seq_hi_res;
61     u8 clk_seq_low;
62     u16 node0_1;
63     u32 node2_5;
64 };
65
66 static void sha1_hash(const char *namespace, const char *name,
67     unsigned char sha1[SHA1_DIGEST_LENGTH])
68 {
69     SHA1_CTX ctx;
70     SHA1Init(&ctx);
71     SHA1Update(&ctx, (const u8*)namespace, strlen(namespace));
72     SHA1Update(&ctx, (const u8*)name, strlen(name));
73     SHA1Final(sha1, &ctx);
74 }
75
76 static void generate_sha1_uuid(const char *namespace, const char *name, u8 result[16])
77 {
78     unsigned char sha1[SHA1_DIGEST_LENGTH];
79     struct uuid *uuid = (struct uuid *)result;
80
81     sha1_hash(namespace, name, (unsigned char*)sha1);
82     memcpy(uuid, sha1, sizeof(struct uuid));
83
84     uuid->time_low = ntohl(uuid->time_low);
85     uuid->time_mid = ntohs(uuid->time_mid);
86     uuid->time_hi_and_version = ntohs(uuid->time_hi_and_version);
87     uuid->time_hi_and_version &= 0x0FFF;
88     uuid->time_hi_and_version |= (5 << 12);
89     uuid->clk_seq_hi_res &= ~(1 << 6);
90     uuid->clk_seq_hi_res |= 1 << 7;
91 }
92
93 /* returns 1 if a is a power of b */
94 static int is_power_of(int a, int b)
95 {
96         while (a > b) {
97                 if (a % b)
98                         return 0;
99                 a /= b;
100         }
101
102         return (a == b) ? 1 : 0;
103 }
104
105 int bitmap_get_bit(u8 *bitmap, u32 bit)
106 {
107         if (bitmap[bit / 8] & (1 << (bit % 8)))
108                 return 1;
109
110         return 0;
111 }
112
113 void bitmap_clear_bit(u8 *bitmap, u32 bit)
114 {
115         bitmap[bit / 8] &= ~(1 << (bit % 8));
116
117         return;
118 }
119
120 /* Returns 1 if the bg contains a backup superblock.  On filesystems with
121    the sparse_super feature, only block groups 0, 1, and powers of 3, 5,
122    and 7 have backup superblocks.  Otherwise, all block groups have backup
123    superblocks */
124 int ext4_bg_has_super_block(int bg)
125 {
126         /* Without sparse_super, every block group has a superblock */
127         if (!(info.feat_ro_compat & EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER))
128                 return 1;
129
130         if (bg == 0 || bg == 1)
131                 return 1;
132
133         if (is_power_of(bg, 3) || is_power_of(bg, 5) || is_power_of(bg, 7))
134                 return 1;
135
136         return 0;
137 }
138
139 /* Function to read the primary superblock */
140 void read_sb(int fd, struct ext4_super_block *sb)
141 {
142         off64_t ret;
143
144         ret = lseek64(fd, 1024, SEEK_SET);
145         if (ret < 0)
146                 critical_error_errno("failed to seek to superblock");
147
148         ret = read(fd, sb, sizeof(*sb));
149         if (ret < 0)
150                 critical_error_errno("failed to read superblock");
151         if (ret != sizeof(*sb))
152                 critical_error("failed to read all of superblock");
153 }
154
155 /* Function to write a primary or backup superblock at a given offset */
156 void write_sb(int fd, unsigned long long offset, struct ext4_super_block *sb)
157 {
158         off64_t ret;
159
160         ret = lseek64(fd, offset, SEEK_SET);
161         if (ret < 0)
162                 critical_error_errno("failed to seek to superblock");
163
164         ret = write(fd, sb, sizeof(*sb));
165         if (ret < 0)
166                 critical_error_errno("failed to write superblock");
167         if (ret != sizeof(*sb))
168                 critical_error("failed to write all of superblock");
169 }
170
171 static void block_device_write_sb(int fd)
172 {
173         unsigned long long offset;
174         u32 i;
175
176         /* write out the backup superblocks */
177         for (i = 1; i < aux_info.groups; i++) {
178                 if (ext4_bg_has_super_block(i)) {
179                         offset = info.block_size * (aux_info.first_data_block
180                                 + i * info.blocks_per_group);
181                         write_sb(fd, offset, aux_info.backup_sb[i]);
182                 }
183         }
184
185         /* write out the primary superblock */
186         write_sb(fd, 1024, aux_info.sb);
187 }
188
189 /* Write the filesystem image to a file */
190 void write_ext4_image(int fd, int gz, int sparse, int crc)
191 {
192         sparse_file_write(ext4_sparse_file, fd, gz, sparse, crc);
193
194         if (info.block_device)
195                 block_device_write_sb(fd);
196 }
197
198 /* Compute the rest of the parameters of the filesystem from the basic info */
199 void ext4_create_fs_aux_info()
200 {
201         aux_info.first_data_block = (info.block_size > 1024) ? 0 : 1;
202         aux_info.len_blocks = info.len / info.block_size;
203         aux_info.inode_table_blocks = DIV_ROUND_UP(info.inodes_per_group * info.inode_size,
204                 info.block_size);
205         aux_info.groups = DIV_ROUND_UP(aux_info.len_blocks - aux_info.first_data_block,
206                 info.blocks_per_group);
207         aux_info.blocks_per_ind = info.block_size / sizeof(u32);
208         aux_info.blocks_per_dind = aux_info.blocks_per_ind * aux_info.blocks_per_ind;
209         aux_info.blocks_per_tind = aux_info.blocks_per_dind * aux_info.blocks_per_dind;
210
211         aux_info.bg_desc_blocks =
212                 DIV_ROUND_UP(aux_info.groups * sizeof(struct ext2_group_desc),
213                         info.block_size);
214
215         aux_info.default_i_flags = EXT4_NOATIME_FL;
216
217         u32 last_group_size = aux_info.len_blocks % info.blocks_per_group;
218         u32 last_header_size = 2 + aux_info.inode_table_blocks;
219         if (ext4_bg_has_super_block(aux_info.groups - 1))
220                 last_header_size += 1 + aux_info.bg_desc_blocks +
221                         info.bg_desc_reserve_blocks;
222         if (last_group_size > 0 && last_group_size < last_header_size) {
223                 aux_info.groups--;
224                 aux_info.len_blocks -= last_group_size;
225         }
226
227         /* A zero-filled superblock to be written firstly to the block
228          * device to mark the file-system as invalid
229          */
230         aux_info.sb_zero = calloc(1, info.block_size);
231         if (!aux_info.sb_zero)
232                 critical_error_errno("calloc");
233
234         /* The write_data* functions expect only block aligned calls.
235          * This is not an issue, except when we write out the super
236          * block on a system with a block size > 1K.  So, we need to
237          * deal with that here.
238          */
239         aux_info.sb_block = calloc(1, info.block_size);
240         if (!aux_info.sb_block)
241                 critical_error_errno("calloc");
242
243         if (info.block_size > 1024)
244                 aux_info.sb = (struct ext4_super_block *)((char *)aux_info.sb_block + 1024);
245         else
246                 aux_info.sb = aux_info.sb_block;
247
248         /* Alloc an array to hold the pointers to the backup superblocks */
249         aux_info.backup_sb = calloc(aux_info.groups, sizeof(char *));
250
251         if (!aux_info.sb)
252                 critical_error_errno("calloc");
253
254         aux_info.bg_desc = calloc(info.block_size, aux_info.bg_desc_blocks);
255         if (!aux_info.bg_desc)
256                 critical_error_errno("calloc");
257         aux_info.xattrs = NULL;
258 }
259
260 void ext4_free_fs_aux_info()
261 {
262         unsigned int i;
263
264         for (i=0; i<aux_info.groups; i++) {
265                 if (aux_info.backup_sb[i])
266                         free(aux_info.backup_sb[i]);
267         }
268         free(aux_info.sb_block);
269         free(aux_info.sb_zero);
270         free(aux_info.bg_desc);
271 }
272
273 /* Fill in the superblock memory buffer based on the filesystem parameters */
274 void ext4_fill_in_sb(int real_uuid)
275 {
276         unsigned int i;
277         struct ext4_super_block *sb = aux_info.sb;
278
279         sb->s_inodes_count = info.inodes_per_group * aux_info.groups;
280         sb->s_blocks_count_lo = aux_info.len_blocks;
281         sb->s_r_blocks_count_lo = 0;
282         sb->s_free_blocks_count_lo = 0;
283         sb->s_free_inodes_count = 0;
284         sb->s_first_data_block = aux_info.first_data_block;
285         sb->s_log_block_size = log_2(info.block_size / 1024);
286         sb->s_obso_log_frag_size = log_2(info.block_size / 1024);
287         sb->s_blocks_per_group = info.blocks_per_group;
288         sb->s_obso_frags_per_group = info.blocks_per_group;
289         sb->s_inodes_per_group = info.inodes_per_group;
290         sb->s_mtime = 0;
291         sb->s_wtime = 0;
292         sb->s_mnt_count = 0;
293         sb->s_max_mnt_count = 0xFFFF;
294         sb->s_magic = EXT4_SUPER_MAGIC;
295         sb->s_state = EXT4_VALID_FS;
296         sb->s_errors = EXT4_ERRORS_RO;
297         sb->s_minor_rev_level = 0;
298         sb->s_lastcheck = 0;
299         sb->s_checkinterval = 0;
300         sb->s_creator_os = EXT4_OS_LINUX;
301         sb->s_rev_level = EXT4_DYNAMIC_REV;
302         sb->s_def_resuid = EXT4_DEF_RESUID;
303         sb->s_def_resgid = EXT4_DEF_RESGID;
304
305         sb->s_first_ino = EXT4_GOOD_OLD_FIRST_INO;
306         sb->s_inode_size = info.inode_size;
307         sb->s_block_group_nr = 0;
308         sb->s_feature_compat = info.feat_compat;
309         sb->s_feature_incompat = info.feat_incompat;
310         sb->s_feature_ro_compat = info.feat_ro_compat;
311         if (real_uuid == 1) {
312 #ifdef REAL_UUID
313             uuid_generate(sb->s_uuid);
314 #else
315             fprintf(stderr, "Not compiled with real UUID support\n");
316             abort();
317 #endif
318         } else {
319             generate_sha1_uuid("extandroid/make_ext4fs", info.label, sb->s_uuid);
320         }
321         memset(sb->s_volume_name, 0, sizeof(sb->s_volume_name));
322         strncpy(sb->s_volume_name, info.label, sizeof(sb->s_volume_name));
323         memset(sb->s_last_mounted, 0, sizeof(sb->s_last_mounted));
324         sb->s_algorithm_usage_bitmap = 0;
325
326         sb->s_reserved_gdt_blocks = info.bg_desc_reserve_blocks;
327         sb->s_prealloc_blocks = 0;
328         sb->s_prealloc_dir_blocks = 0;
329
330         //memcpy(sb->s_journal_uuid, sb->s_uuid, sizeof(sb->s_journal_uuid));
331         if (info.feat_compat & EXT4_FEATURE_COMPAT_HAS_JOURNAL)
332                 sb->s_journal_inum = EXT4_JOURNAL_INO;
333         sb->s_journal_dev = 0;
334         sb->s_last_orphan = 0;
335         sb->s_hash_seed[0] = 0; /* FIXME */
336         sb->s_def_hash_version = DX_HASH_TEA;
337         sb->s_reserved_char_pad = EXT4_JNL_BACKUP_BLOCKS;
338         sb->s_desc_size = sizeof(struct ext2_group_desc);
339         sb->s_default_mount_opts = 0; /* FIXME */
340         sb->s_first_meta_bg = 0;
341         sb->s_mkfs_time = 0;
342         //sb->s_jnl_blocks[17]; /* FIXME */
343
344         sb->s_blocks_count_hi = aux_info.len_blocks >> 32;
345         sb->s_r_blocks_count_hi = 0;
346         sb->s_free_blocks_count_hi = 0;
347         sb->s_min_extra_isize = sizeof(struct ext4_inode) -
348                 EXT4_GOOD_OLD_INODE_SIZE;
349         sb->s_want_extra_isize = sizeof(struct ext4_inode) -
350                 EXT4_GOOD_OLD_INODE_SIZE;
351         sb->s_flags = 2;
352         sb->s_raid_stride = 0;
353         sb->s_mmp_interval = 0;
354         sb->s_mmp_block = 0;
355         sb->s_raid_stripe_width = 0;
356         sb->s_log_groups_per_flex = 0;
357         sb->s_kbytes_written = 0;
358
359         for (i = 0; i < aux_info.groups; i++) {
360                 u64 group_start_block = aux_info.first_data_block + i *
361                         info.blocks_per_group;
362                 u32 header_size = 0;
363                 if (ext4_bg_has_super_block(i)) {
364                         if (i != 0) {
365                                 aux_info.backup_sb[i] = calloc(info.block_size, 1);
366                                 memcpy(aux_info.backup_sb[i], sb, sizeof(struct ext4_super_block));
367                                 /* Update the block group nr of this backup superblock */
368                                 aux_info.backup_sb[i]->s_block_group_nr = i;
369                                 ext4_queue_sb(group_start_block, info.block_device ?
370                                                 aux_info.sb_zero : aux_info.backup_sb[i]);
371                         }
372                         sparse_file_add_data(ext4_sparse_file, aux_info.bg_desc,
373                                 aux_info.bg_desc_blocks * info.block_size,
374                                 group_start_block + 1);
375                         header_size = 1 + aux_info.bg_desc_blocks + info.bg_desc_reserve_blocks;
376                 }
377
378                 aux_info.bg_desc[i].bg_block_bitmap = group_start_block + header_size;
379                 aux_info.bg_desc[i].bg_inode_bitmap = group_start_block + header_size + 1;
380                 aux_info.bg_desc[i].bg_inode_table = group_start_block + header_size + 2;
381
382                 aux_info.bg_desc[i].bg_free_blocks_count = sb->s_blocks_per_group;
383                 aux_info.bg_desc[i].bg_free_inodes_count = sb->s_inodes_per_group;
384                 aux_info.bg_desc[i].bg_used_dirs_count = 0;
385         }
386
387         /* Queue the primary superblock to be written out - if it's a block device,
388          * queue a zero-filled block first, the correct version of superblock will
389          * be written to the block device after all other blocks are written.
390          *
391          * The file-system on the block device will not be valid until the correct
392          * version of superblocks are written, this is to avoid the likelihood of a
393          * partially created file-system.
394          */
395         ext4_queue_sb(aux_info.first_data_block, info.block_device ?
396                                 aux_info.sb_zero : aux_info.sb_block);
397 }
398
399
400 void ext4_queue_sb(u64 start_block, struct ext4_super_block *sb)
401 {
402         sparse_file_add_data(ext4_sparse_file, sb, info.block_size, start_block);
403 }
404
405 void ext4_parse_sb_info(struct ext4_super_block *sb)
406 {
407         if (sb->s_magic != EXT4_SUPER_MAGIC)
408                 error("superblock magic incorrect");
409
410         if ((sb->s_state & EXT4_VALID_FS) != EXT4_VALID_FS)
411                 error("filesystem state not valid");
412
413         ext4_parse_sb(sb, &info);
414
415         ext4_create_fs_aux_info();
416
417         memcpy(aux_info.sb, sb, sizeof(*sb));
418
419         if (aux_info.first_data_block != sb->s_first_data_block)
420                 critical_error("first data block does not match");
421 }
422
423 void ext4_create_resize_inode()
424 {
425         struct block_allocation *reserve_inode_alloc = create_allocation();
426         u32 reserve_inode_len = 0;
427         unsigned int i;
428
429         struct ext4_inode *inode = get_inode(EXT4_RESIZE_INO);
430         if (inode == NULL) {
431                 error("failed to get resize inode");
432                 return;
433         }
434
435         for (i = 0; i < aux_info.groups; i++) {
436                 if (ext4_bg_has_super_block(i)) {
437                         u64 group_start_block = aux_info.first_data_block + i *
438                                 info.blocks_per_group;
439                         u32 reserved_block_start = group_start_block + 1 +
440                                 aux_info.bg_desc_blocks;
441                         u32 reserved_block_len = info.bg_desc_reserve_blocks;
442                         append_region(reserve_inode_alloc, reserved_block_start,
443                                 reserved_block_len, i);
444                         reserve_inode_len += reserved_block_len;
445                 }
446         }
447
448         inode_attach_resize(inode, reserve_inode_alloc);
449
450         inode->i_mode = S_IFREG | S_IRUSR | S_IWUSR;
451         inode->i_links_count = 1;
452
453         free_alloc(reserve_inode_alloc);
454 }
455
456 /* Allocate the blocks to hold a journal inode and connect them to the
457    reserved journal inode */
458 void ext4_create_journal_inode()
459 {
460         struct ext4_inode *inode = get_inode(EXT4_JOURNAL_INO);
461         if (inode == NULL) {
462                 error("failed to get journal inode");
463                 return;
464         }
465
466         u8 *journal_data = inode_allocate_data_extents(inode,
467                         info.journal_blocks * info.block_size,
468                         info.journal_blocks * info.block_size);
469         if (!journal_data) {
470                 error("failed to allocate extents for journal data");
471                 return;
472         }
473
474         inode->i_mode = S_IFREG | S_IRUSR | S_IWUSR;
475         inode->i_links_count = 1;
476
477         journal_superblock_t *jsb = (journal_superblock_t *)journal_data;
478         jsb->s_header.h_magic = htonl(JBD2_MAGIC_NUMBER);
479         jsb->s_header.h_blocktype = htonl(JBD2_SUPERBLOCK_V2);
480         jsb->s_blocksize = htonl(info.block_size);
481         jsb->s_maxlen = htonl(info.journal_blocks);
482         jsb->s_nr_users = htonl(1);
483         jsb->s_first = htonl(1);
484         jsb->s_sequence = htonl(1);
485
486         memcpy(aux_info.sb->s_jnl_blocks, &inode->i_block, sizeof(inode->i_block));
487 }
488
489 /* Update the number of free blocks and inodes in the filesystem and in each
490    block group */
491 void ext4_update_free()
492 {
493         u32 i;
494
495         for (i = 0; i < aux_info.groups; i++) {
496                 u32 bg_free_blocks = get_free_blocks(i);
497                 u32 bg_free_inodes = get_free_inodes(i);
498                 u16 crc;
499
500                 aux_info.bg_desc[i].bg_free_blocks_count = bg_free_blocks;
501                 aux_info.sb->s_free_blocks_count_lo += bg_free_blocks;
502
503                 aux_info.bg_desc[i].bg_free_inodes_count = bg_free_inodes;
504                 aux_info.sb->s_free_inodes_count += bg_free_inodes;
505
506                 aux_info.bg_desc[i].bg_used_dirs_count += get_directories(i);
507
508                 aux_info.bg_desc[i].bg_flags = get_bg_flags(i);
509
510                 crc = ext4_crc16(~0, aux_info.sb->s_uuid, sizeof(aux_info.sb->s_uuid));
511                 crc = ext4_crc16(crc, &i, sizeof(i));
512                 crc = ext4_crc16(crc, &aux_info.bg_desc[i], offsetof(struct ext2_group_desc, bg_checksum));
513                 aux_info.bg_desc[i].bg_checksum = crc;
514         }
515 }
516
517 u64 get_block_device_size(int fd)
518 {
519         u64 size = 0;
520         int ret;
521
522 #if defined(__linux__)
523         ret = ioctl(fd, BLKGETSIZE64, &size);
524 #elif defined(__APPLE__) && defined(__MACH__)
525         ret = ioctl(fd, DKIOCGETBLOCKCOUNT, &size);
526 #else
527         close(fd);
528         return 0;
529 #endif
530
531         if (ret)
532                 return 0;
533
534         return size;
535 }
536
537 int is_block_device_fd(int fd)
538 {
539 #ifdef USE_MINGW
540         return 0;
541 #else
542         struct stat st;
543         int ret = fstat(fd, &st);
544         if (ret < 0)
545                 return 0;
546
547         return S_ISBLK(st.st_mode);
548 #endif
549 }
550
551 u64 get_file_size(int fd)
552 {
553         struct stat buf;
554         int ret;
555         u64 reserve_len = 0;
556         s64 computed_size;
557
558         ret = fstat(fd, &buf);
559         if (ret)
560                 return 0;
561
562         if (info.len < 0)
563                 reserve_len = -info.len;
564
565         if (S_ISREG(buf.st_mode))
566                 computed_size = buf.st_size - reserve_len;
567         else if (S_ISBLK(buf.st_mode))
568                 computed_size = get_block_device_size(fd) - reserve_len;
569         else
570                 computed_size = 0;
571
572         if (computed_size < 0) {
573                 warn("Computed filesystem size less than 0");
574                 computed_size = 0;
575         }
576
577         return computed_size;
578 }
579
580 u64 parse_num(const char *arg)
581 {
582         char *endptr;
583         u64 num = strtoull(arg, &endptr, 10);
584         if (*endptr == 'k' || *endptr == 'K')
585                 num *= 1024LL;
586         else if (*endptr == 'm' || *endptr == 'M')
587                 num *= 1024LL * 1024LL;
588         else if (*endptr == 'g' || *endptr == 'G')
589                 num *= 1024LL * 1024LL * 1024LL;
590
591         return num;
592 }
593
594 int read_ext(int fd, int verbose)
595 {
596         off64_t ret;
597         struct ext4_super_block sb;
598
599         read_sb(fd, &sb);
600
601         ext4_parse_sb_info(&sb);
602
603         ret = lseek64(fd, info.len, SEEK_SET);
604         if (ret < 0)
605                 critical_error_errno("failed to seek to end of input image");
606
607         ret = lseek64(fd, info.block_size * (aux_info.first_data_block + 1), SEEK_SET);
608         if (ret < 0)
609                 critical_error_errno("failed to seek to block group descriptors");
610
611         ret = read(fd, aux_info.bg_desc, info.block_size * aux_info.bg_desc_blocks);
612         if (ret < 0)
613                 critical_error_errno("failed to read block group descriptors");
614         if (ret != (int)info.block_size * (int)aux_info.bg_desc_blocks)
615                 critical_error("failed to read all of block group descriptors");
616
617         if (verbose) {
618                 printf("Found filesystem with parameters:\n");
619                 printf("    Size: %"PRIu64"\n", info.len);
620                 printf("    Block size: %d\n", info.block_size);
621                 printf("    Blocks per group: %d\n", info.blocks_per_group);
622                 printf("    Inodes per group: %d\n", info.inodes_per_group);
623                 printf("    Inode size: %d\n", info.inode_size);
624                 printf("    Label: %s\n", info.label);
625                 printf("    Blocks: %"PRIu64"\n", aux_info.len_blocks);
626                 printf("    Block groups: %d\n", aux_info.groups);
627                 printf("    Reserved block group size: %d\n", info.bg_desc_reserve_blocks);
628                 printf("    Used %d/%d inodes and %d/%d blocks\n",
629                         aux_info.sb->s_inodes_count - aux_info.sb->s_free_inodes_count,
630                         aux_info.sb->s_inodes_count,
631                         aux_info.sb->s_blocks_count_lo - aux_info.sb->s_free_blocks_count_lo,
632                         aux_info.sb->s_blocks_count_lo);
633         }
634
635         return 0;
636 }
637