aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2013-10-07 14:37:41 -0500
committerRob Landley <rob@landley.net>2013-10-07 14:37:41 -0500
commitef13522938025fbc56a1a6fc27c6887965d98630 (patch)
treebc8abb96a1fb1a681322bb256dd6d1c50db980fb
parent730d5a851fd8d8d39497e1dbb334baa583816c61 (diff)
downloadtoybox-ef13522938025fbc56a1a6fc27c6887965d98630.tar.gz
blkid cleanup: Convert tabs to spaces.
-rw-r--r--toys/pending/blkid.c162
1 files changed, 81 insertions, 81 deletions
diff --git a/toys/pending/blkid.c b/toys/pending/blkid.c
index b413047b..295e4a7e 100644
--- a/toys/pending/blkid.c
+++ b/toys/pending/blkid.c
@@ -26,10 +26,10 @@ config BLKID
#define C2I(a,b,c,d) (a|(b<<8)|(c<<16)|(d<<24))
typedef struct fs_info{
- unsigned uuid_off;
- unsigned lab_off;
- short uuid_t;
- short lab_len;
+ unsigned uuid_off;
+ unsigned lab_off;
+ short uuid_t;
+ short lab_len;
}fs_info_t;
//#define SET_FS(t) (fs_info_t){t##_UUID,t##_LABEL,t##_UUID_T,t##_LABEL_SZ}
@@ -122,92 +122,92 @@ typedef struct fs_info{
#if (CFG_BLKID)
char *toutf8(unsigned short * ws){ /* hack for NTFS utf16 */
- static char buf[16];
- int i=0;
- while((buf[i++]=*ws++));
- return buf;
+ static char buf[16];
+ int i=0;
+ while((buf[i++]=*ws++));
+ return buf;
}
#endif
/* TODO if no args use proc/partitions */
void do_blkid(int fd, char *name){
- fs_info_t fs;
- char *fstype;
- unsigned char buf[66560]; /*toybuf is only 4096, could rework logic*/
- int sb_read;
-
- sb_read = read(fd, &buf, sizeof(buf));
- if (sb_read < 1) return;
-
- if MATCH(buf,ADFS){
- fstype="adfs";
- if (CFG_BLKID) fs=SET_FS(ADFS);
- }else if MATCH(buf,BFS){
- fstype="bfs";
- if (CFG_BLKID) fs=SET_FS(BFS);
- }else if MATCH(buf,CRAMFS){
- fstype="cramfs";
- if (CFG_BLKID) fs=SET_FS(CRAMFS);
- }else if MATCH3(buf,EXT){
- fstype=(buf[EXT3_BYTE]&BIT(2))?((buf[EXT4_BYTE]&BIT(6))?"ext4":"ext3"):"ext2";
- if (CFG_BLKID) fs=SET_FS(EXT);
- }else if MATCH(buf,F2FS){
- fstype="f2fs";
- if (CFG_BLKID) fs=SET_FS(F2FS);
- }else if MATCH(buf,NILFS){
- fstype="nilfs";
- if (CFG_BLKID) fs=SET_FS(NILFS);
- }else if MATCH(buf,NTFS){
- fstype="ntfs";
- if (CFG_BLKID) fs=SET_FS(NTFS);
- }else if MATCH(buf,XIAFS){
- fstype="xiafs";
- if (CFG_BLKID) fs=SET_FS(XIAFS);
+ fs_info_t fs;
+ char *fstype;
+ unsigned char buf[66560]; /*toybuf is only 4096, could rework logic*/
+ int sb_read;
+
+ sb_read = read(fd, &buf, sizeof(buf));
+ if (sb_read < 1) return;
+
+ if MATCH(buf,ADFS){
+ fstype="adfs";
+ if (CFG_BLKID) fs=SET_FS(ADFS);
+ }else if MATCH(buf,BFS){
+ fstype="bfs";
+ if (CFG_BLKID) fs=SET_FS(BFS);
+ }else if MATCH(buf,CRAMFS){
+ fstype="cramfs";
+ if (CFG_BLKID) fs=SET_FS(CRAMFS);
+ }else if MATCH3(buf,EXT){
+ fstype=(buf[EXT3_BYTE]&BIT(2))?((buf[EXT4_BYTE]&BIT(6))?"ext4":"ext3"):"ext2";
+ if (CFG_BLKID) fs=SET_FS(EXT);
+ }else if MATCH(buf,F2FS){
+ fstype="f2fs";
+ if (CFG_BLKID) fs=SET_FS(F2FS);
+ }else if MATCH(buf,NILFS){
+ fstype="nilfs";
+ if (CFG_BLKID) fs=SET_FS(NILFS);
+ }else if MATCH(buf,NTFS){
+ fstype="ntfs";
+ if (CFG_BLKID) fs=SET_FS(NTFS);
+ }else if MATCH(buf,XIAFS){
+ fstype="xiafs";
+ if (CFG_BLKID) fs=SET_FS(XIAFS);
/*below here would require more than 1 toybuf*/
- }else if MATCH(buf,REISER){
- fstype="reiserfs";
- if (CFG_BLKID) fs=SET_FS(REISER);
- }else if MATCH(buf,JFS){
- fstype="jfs";
- if (CFG_BLKID) fs=SET_FS(JFS);
- }else if MATCH(buf,BTRFS){
- fstype="btrfs";
- if (CFG_BLKID) fs=SET_FS(BTRFS);
- }else if MATCH(buf,REISERB){
- fstype="reiserfs";
- if (CFG_BLKID) fs=SET_FS(REISERB);
- }else return;
+ }else if MATCH(buf,REISER){
+ fstype="reiserfs";
+ if (CFG_BLKID) fs=SET_FS(REISER);
+ }else if MATCH(buf,JFS){
+ fstype="jfs";
+ if (CFG_BLKID) fs=SET_FS(JFS);
+ }else if MATCH(buf,BTRFS){
+ fstype="btrfs";
+ if (CFG_BLKID) fs=SET_FS(BTRFS);
+ }else if MATCH(buf,REISERB){
+ fstype="reiserfs";
+ if (CFG_BLKID) fs=SET_FS(REISERB);
+ }else return;
if (CFG_BLKID && !strncmp("blkid",toys.which->name,5) ){
- printf("%s:",name);
- if ( fs.lab_len > 0 )
- printf(" LABEL=\"%.*s\"", fs.lab_len, (char *)&buf[fs.lab_off]);
- else if ( fs.lab_len < 0 )
- printf(" LABEL=\"%.*s\"", -fs.lab_len,
- toutf8((unsigned short *)&buf[fs.lab_off]));
- if ( fs.uuid_off > 0 ){
- if ( fs.uuid_t == 16 )
- printf(" UUID=\"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-"
- "%02x%02x%02x%02x%02x%02x\"",
- buf[fs.uuid_off], buf[fs.uuid_off+1],
- buf[fs.uuid_off+2], buf[fs.uuid_off+3],
- buf[fs.uuid_off+4], buf[fs.uuid_off+5],
- buf[fs.uuid_off+6], buf[fs.uuid_off+7],
- buf[fs.uuid_off+8], buf[fs.uuid_off+9],
- buf[fs.uuid_off+10], buf[fs.uuid_off+11],
- buf[fs.uuid_off+12], buf[fs.uuid_off+13],
- buf[fs.uuid_off+14], buf[fs.uuid_off+15]);
- if ( fs.uuid_t == 8 )
- printf(" UUID=\"%02X%02X%02X%02X%02X%02X%02X%02X\"",
- buf[fs.uuid_off+7], buf[fs.uuid_off+6],
- buf[fs.uuid_off+5], buf[fs.uuid_off+4],
- buf[fs.uuid_off+3], buf[fs.uuid_off+2],
- buf[fs.uuid_off+1], buf[fs.uuid_off]);
- }
- printf(" TYPE=\"%s\"",fstype);
+ printf("%s:",name);
+ if ( fs.lab_len > 0 )
+ printf(" LABEL=\"%.*s\"", fs.lab_len, (char *)&buf[fs.lab_off]);
+ else if ( fs.lab_len < 0 )
+ printf(" LABEL=\"%.*s\"", -fs.lab_len,
+ toutf8((unsigned short *)&buf[fs.lab_off]));
+ if ( fs.uuid_off > 0 ){
+ if ( fs.uuid_t == 16 )
+ printf(" UUID=\"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-"
+ "%02x%02x%02x%02x%02x%02x\"",
+ buf[fs.uuid_off], buf[fs.uuid_off+1],
+ buf[fs.uuid_off+2], buf[fs.uuid_off+3],
+ buf[fs.uuid_off+4], buf[fs.uuid_off+5],
+ buf[fs.uuid_off+6], buf[fs.uuid_off+7],
+ buf[fs.uuid_off+8], buf[fs.uuid_off+9],
+ buf[fs.uuid_off+10], buf[fs.uuid_off+11],
+ buf[fs.uuid_off+12], buf[fs.uuid_off+13],
+ buf[fs.uuid_off+14], buf[fs.uuid_off+15]);
+ if ( fs.uuid_t == 8 )
+ printf(" UUID=\"%02X%02X%02X%02X%02X%02X%02X%02X\"",
+ buf[fs.uuid_off+7], buf[fs.uuid_off+6],
+ buf[fs.uuid_off+5], buf[fs.uuid_off+4],
+ buf[fs.uuid_off+3], buf[fs.uuid_off+2],
+ buf[fs.uuid_off+1], buf[fs.uuid_off]);
+ }
+ printf(" TYPE=\"%s\"",fstype);
}else /* fstype */
- write(1,fstype,strlen(fstype)); /* avoid printf overhead in fstype */
- putchar('\n');
+ write(1,fstype,strlen(fstype)); /* avoid printf overhead in fstype */
+ putchar('\n');
}
#if (CFG_BLKID)