History

fuse: fix type definitions in uapi header

Commit 7e98d53086d18c877cb44e9065219335184024de (Synchronize fuse header with one used in library) added #ifdef __linux__ around defines if it is not set. The kernel build is self-contained and can be built on non-Linux toolchains. After the mentioned commit builds on non-Linux toolchains will try to include stdint.h and fail due to -nostdinc, and then fail with a bunch of undefined type errors. Fix by checking for __KERNEL__ instead of __linux__ and using the standard int types instead of the linux specific ones.

Miklos Szeredi committed 13 years ago

Commit 4c824561 parent 41ef2d51 file · +216 −220Browse files

Showing the changes to include/uapi/linux (1 of 1 file). Show all

Unified · Split

include/uapi/linux/fuse.h+216−220
@@ -95,15 +95,10 @@ · 94 unmodified lines
9595 #ifndef _LINUX_FUSE_H
9696 #define _LINUX_FUSE_H
9797
98−#ifdef __linux__
98+#ifdef __KERNEL__
9999 #include <linux/types.h>
100100 #else
101101 #include <stdint.h>
102−#define __u64 uint64_t
103−#define __s64 int64_t
104−#define __u32 uint32_t
105−#define __s32 int32_t
106−#define __u16 uint16_t
107102 #endif
108103
109104 /*
@@ -139,42 +134,42 @@ · 29 unmodified lines
139134 userspace works under 64bit kernels */
140135
141136 struct fuse_attr {
142− __u64 ino;
143− __u64 size;
144− __u64 blocks;
145− __u64 atime;
146− __u64 mtime;
147− __u64 ctime;
148− __u32 atimensec;
149− __u32 mtimensec;
150− __u32 ctimensec;
151− __u32 mode;
152− __u32 nlink;
153− __u32 uid;
154− __u32 gid;
155− __u32 rdev;
156− __u32 blksize;
157− __u32 padding;
137+ uint64_t ino;
138+ uint64_t size;
139+ uint64_t blocks;
140+ uint64_t atime;
141+ uint64_t mtime;
142+ uint64_t ctime;
143+ uint32_t atimensec;
144+ uint32_t mtimensec;
145+ uint32_t ctimensec;
146+ uint32_t mode;
147+ uint32_t nlink;
148+ uint32_t uid;
149+ uint32_t gid;
150+ uint32_t rdev;
151+ uint32_t blksize;
152+ uint32_t padding;
158153 };
159154
160155 struct fuse_kstatfs {
161− __u64 blocks;
162− __u64 bfree;
163− __u64 bavail;
164− __u64 files;
165− __u64 ffree;
166− __u32 bsize;
167− __u32 namelen;
168− __u32 frsize;
169− __u32 padding;
170− __u32 spare[6];
156+ uint64_t blocks;
157+ uint64_t bfree;
158+ uint64_t bavail;
159+ uint64_t files;
160+ uint64_t ffree;
161+ uint32_t bsize;
162+ uint32_t namelen;
163+ uint32_t frsize;
164+ uint32_t padding;
165+ uint32_t spare[6];
171166 };
172167
173168 struct fuse_file_lock {
174− __u64 start;
175− __u64 end;
176− __u32 type;
177− __u32 pid; /* tgid */
169+ uint64_t start;
170+ uint64_t end;
171+ uint32_t type;
172+ uint32_t pid; /* tgid */
178173 };
179174
180175 /**
@@ -364,143 +359,143 @@ enum fuse_notify_code { · 183 unmodified lines
364359 #define FUSE_COMPAT_ENTRY_OUT_SIZE 120
365360
366361 struct fuse_entry_out {
367− __u64 nodeid; /* Inode ID */
368− __u64 generation; /* Inode generation: nodeid:gen must
369− be unique for the fs's lifetime */
370− __u64 entry_valid; /* Cache timeout for the name */
371− __u64 attr_valid; /* Cache timeout for the attributes */
372− __u32 entry_valid_nsec;
373− __u32 attr_valid_nsec;
362+ uint64_t nodeid; /* Inode ID */
363+ uint64_t generation; /* Inode generation: nodeid:gen must
364+ be unique for the fs's lifetime */
365+ uint64_t entry_valid; /* Cache timeout for the name */
366+ uint64_t attr_valid; /* Cache timeout for the attributes */
367+ uint32_t entry_valid_nsec;
368+ uint32_t attr_valid_nsec;
374369 struct fuse_attr attr;
375370 };
376371
377372 struct fuse_forget_in {
378− __u64 nlookup;
373+ uint64_t nlookup;
379374 };
380375
381376 struct fuse_forget_one {
382− __u64 nodeid;
383− __u64 nlookup;
377+ uint64_t nodeid;
378+ uint64_t nlookup;
384379 };
385380
386381 struct fuse_batch_forget_in {
387− __u32 count;
388− __u32 dummy;
382+ uint32_t count;
383+ uint32_t dummy;
389384 };
390385
391386 struct fuse_getattr_in {
392− __u32 getattr_flags;
393− __u32 dummy;
394− __u64 fh;
387+ uint32_t getattr_flags;
388+ uint32_t dummy;
389+ uint64_t fh;
395390 };
396391
397392 #define FUSE_COMPAT_ATTR_OUT_SIZE 96
398393
399394 struct fuse_attr_out {
400− __u64 attr_valid; /* Cache timeout for the attributes */
401− __u32 attr_valid_nsec;
402− __u32 dummy;
395+ uint64_t attr_valid; /* Cache timeout for the attributes */
396+ uint32_t attr_valid_nsec;
397+ uint32_t dummy;
403398 struct fuse_attr attr;
404399 };
405400
406401 #define FUSE_COMPAT_MKNOD_IN_SIZE 8
407402
408403 struct fuse_mknod_in {
409− __u32 mode;
410− __u32 rdev;
411− __u32 umask;
412− __u32 padding;
404+ uint32_t mode;
405+ uint32_t rdev;
406+ uint32_t umask;
407+ uint32_t padding;
413408 };
414409
415410 struct fuse_mkdir_in {
416− __u32 mode;
417− __u32 umask;
411+ uint32_t mode;
412+ uint32_t umask;
418413 };
419414
420415 struct fuse_rename_in {
421− __u64 newdir;
416+ uint64_t newdir;
422417 };
423418
424419 struct fuse_link_in {
425− __u64 oldnodeid;
420+ uint64_t oldnodeid;
426421 };
427422
428423 struct fuse_setattr_in {
429− __u32 valid;
430− __u32 padding;
431− __u64 fh;
432− __u64 size;
433− __u64 lock_owner;
434− __u64 atime;
435− __u64 mtime;
436− __u64 unused2;
437− __u32 atimensec;
438− __u32 mtimensec;
439− __u32 unused3;
440− __u32 mode;
441− __u32 unused4;
442− __u32 uid;
443− __u32 gid;
444− __u32 unused5;
424+ uint32_t valid;
425+ uint32_t padding;
426+ uint64_t fh;
427+ uint64_t size;
428+ uint64_t lock_owner;
429+ uint64_t atime;
430+ uint64_t mtime;
431+ uint64_t unused2;
432+ uint32_t atimensec;
433+ uint32_t mtimensec;
434+ uint32_t unused3;
435+ uint32_t mode;
436+ uint32_t unused4;
437+ uint32_t uid;
438+ uint32_t gid;
439+ uint32_t unused5;
445440 };
446441
447442 struct fuse_open_in {
448− __u32 flags;
449− __u32 unused;
443+ uint32_t flags;
444+ uint32_t unused;
450445 };
451446
452447 struct fuse_create_in {
453− __u32 flags;
454− __u32 mode;
455− __u32 umask;
456− __u32 padding;
448+ uint32_t flags;
449+ uint32_t mode;
450+ uint32_t umask;
451+ uint32_t padding;
457452 };
458453
459454 struct fuse_open_out {
460− __u64 fh;
461− __u32 open_flags;
462− __u32 padding;
455+ uint64_t fh;
456+ uint32_t open_flags;
457+ uint32_t padding;
463458 };
464459
465460 struct fuse_release_in {
466− __u64 fh;
467− __u32 flags;
468− __u32 release_flags;
469− __u64 lock_owner;
461+ uint64_t fh;
462+ uint32_t flags;
463+ uint32_t release_flags;
464+ uint64_t lock_owner;
470465 };
471466
472467 struct fuse_flush_in {
473− __u64 fh;
474− __u32 unused;
475− __u32 padding;
476− __u64 lock_owner;
468+ uint64_t fh;
469+ uint32_t unused;
470+ uint32_t padding;
471+ uint64_t lock_owner;
477472 };
478473
479474 struct fuse_read_in {
480− __u64 fh;
481− __u64 offset;
482− __u32 size;
483− __u32 read_flags;
484− __u64 lock_owner;
485− __u32 flags;
486− __u32 padding;
475+ uint64_t fh;
476+ uint64_t offset;
477+ uint32_t size;
478+ uint32_t read_flags;
479+ uint64_t lock_owner;
480+ uint32_t flags;
481+ uint32_t padding;
487482 };
488483
489484 #define FUSE_COMPAT_WRITE_IN_SIZE 24
490485
491486 struct fuse_write_in {
492− __u64 fh;
493− __u64 offset;
494− __u32 size;
495− __u32 write_flags;
496− __u64 lock_owner;
497− __u32 flags;
498− __u32 padding;
487+ uint64_t fh;
488+ uint64_t offset;
489+ uint32_t size;
490+ uint32_t write_flags;
491+ uint64_t lock_owner;
492+ uint32_t flags;
493+ uint32_t padding;
499494 };
500495
501496 struct fuse_write_out {
502− __u32 size;
503− __u32 padding;
497+ uint32_t size;
498+ uint32_t padding;
504499 };
505500
506501 #define FUSE_COMPAT_STATFS_SIZE 48
@@ -510,32 +505,32 @@ struct fuse_statfs_out { · 3 unmodified lines
510505 };
511506
512507 struct fuse_fsync_in {
513− __u64 fh;
514− __u32 fsync_flags;
515− __u32 padding;
508+ uint64_t fh;
509+ uint32_t fsync_flags;
510+ uint32_t padding;
516511 };
517512
518513 struct fuse_setxattr_in {
519− __u32 size;
520− __u32 flags;
514+ uint32_t size;
515+ uint32_t flags;
521516 };
522517
523518 struct fuse_getxattr_in {
524− __u32 size;
525− __u32 padding;
519+ uint32_t size;
520+ uint32_t padding;
526521 };
527522
528523 struct fuse_getxattr_out {
529− __u32 size;
530− __u32 padding;
524+ uint32_t size;
525+ uint32_t padding;
531526 };
532527
533528 struct fuse_lk_in {
534− __u64 fh;
535− __u64 owner;
529+ uint64_t fh;
530+ uint64_t owner;
536531 struct fuse_file_lock lk;
537− __u32 lk_flags;
538− __u32 padding;
532+ uint32_t lk_flags;
533+ uint32_t padding;
539534 };
540535
541536 struct fuse_lk_out {
@@ -543,134 +538,135 @@ struct fuse_lk_out { · 1 unmodified line
543538 };
544539
545540 struct fuse_access_in {
546− __u32 mask;
547− __u32 padding;
541+ uint32_t mask;
542+ uint32_t padding;
548543 };
549544
550545 struct fuse_init_in {
551− __u32 major;
552− __u32 minor;
553− __u32 max_readahead;
554− __u32 flags;
546+ uint32_t major;
547+ uint32_t minor;
548+ uint32_t max_readahead;
549+ uint32_t flags;
555550 };
556551
557552 struct fuse_init_out {
558− __u32 major;
559− __u32 minor;
560− __u32 max_readahead;
561− __u32 flags;
562− __u16 max_background;
563− __u16 congestion_threshold;
564− __u32 max_write;
553+ uint32_t major;
554+ uint32_t minor;
555+ uint32_t max_readahead;
556+ uint32_t flags;
557+ uint16_t max_background;
558+ uint16_t congestion_threshold;
559+ uint32_t max_write;
565560 };
566561
567562 #define CUSE_INIT_INFO_MAX 4096
568563
569564 struct cuse_init_in {
570− __u32 major;
571− __u32 minor;
572− __u32 unused;
573− __u32 flags;
565+ uint32_t major;
566+ uint32_t minor;
567+ uint32_t unused;
568+ uint32_t flags;
574569 };
575570
576571 struct cuse_init_out {
577− __u32 major;
578− __u32 minor;
579− __u32 unused;
580− __u32 flags;
581− __u32 max_read;
582− __u32 max_write;
583− __u32 dev_major; /* chardev major */
584− __u32 dev_minor; /* chardev minor */
585− __u32 spare[10];
572+ uint32_t major;
573+ uint32_t minor;
574+ uint32_t unused;
575+ uint32_t flags;
576+ uint32_t max_read;
577+ uint32_t max_write;
578+ uint32_t dev_major; /* chardev major */
579+ uint32_t dev_minor; /* chardev minor */
580+ uint32_t spare[10];
586581 };
587582
588583 struct fuse_interrupt_in {
589− __u64 unique;
584+ uint64_t unique;
590585 };
591586
592587 struct fuse_bmap_in {
593− __u64 block;
594− __u32 blocksize;
595− __u32 padding;
588+ uint64_t block;
589+ uint32_t blocksize;
590+ uint32_t padding;
596591 };
597592
598593 struct fuse_bmap_out {
599− __u64 block;
594+ uint64_t block;
600595 };
601596
602597 struct fuse_ioctl_in {
603− __u64 fh;
604− __u32 flags;
605− __u32 cmd;
606− __u64 arg;
607− __u32 in_size;
608− __u32 out_size;
598+ uint64_t fh;
599+ uint32_t flags;
600+ uint32_t cmd;
601+ uint64_t arg;
602+ uint32_t in_size;
603+ uint32_t out_size;
609604 };
610605
611606 struct fuse_ioctl_iovec {
612− __u64 base;
613− __u64 len;
607+ uint64_t base;
608+ uint64_t len;
614609 };
615610
616611 struct fuse_ioctl_out {
617− __s32 result;
618− __u32 flags;
619− __u32 in_iovs;
620− __u32 out_iovs;
612+ int32_t result;
613+ uint32_t flags;
614+ uint32_t in_iovs;
615+ uint32_t out_iovs;
621616 };
622617
623618 struct fuse_poll_in {
624− __u64 fh;
625− __u64 kh;
626− __u32 flags;
627− __u32 events;
619+ uint64_t fh;
620+ uint64_t kh;
621+ uint32_t flags;
622+ uint32_t events;
628623 };
629624
630625 struct fuse_poll_out {
631− __u32 revents;
632− __u32 padding;
626+ uint32_t revents;
627+ uint32_t padding;
633628 };
634629
635630 struct fuse_notify_poll_wakeup_out {
636− __u64 kh;
631+ uint64_t kh;
637632 };
638633
639634 struct fuse_fallocate_in {
640− __u64 fh;
641− __u64 offset;
642− __u64 length;
643− __u32 mode;
644− __u32 padding;
635+ uint64_t fh;
636+ uint64_t offset;
637+ uint64_t length;
638+ uint32_t mode;
639+ uint32_t padding;
645640 };
646641
647642 struct fuse_in_header {
648− __u32 len;
649− __u32 opcode;
650− __u64 unique;
651− __u64 nodeid;
652− __u32 uid;
653− __u32 gid;
654− __u32 pid;
655− __u32 padding;
643+ uint32_t len;
644+ uint32_t opcode;
645+ uint64_t unique;
646+ uint64_t nodeid;
647+ uint32_t uid;
648+ uint32_t gid;
649+ uint32_t pid;
650+ uint32_t padding;
656651 };
657652
658653 struct fuse_out_header {
659− __u32 len;
660− __s32 error;
661− __u64 unique;
654+ uint32_t len;
655+ int32_t error;
656+ uint64_t unique;
662657 };
663658
664659 struct fuse_dirent {
665− __u64 ino;
666− __u64 off;
667− __u32 namelen;
668− __u32 type;
660+ uint64_t ino;
661+ uint64_t off;
662+ uint32_t namelen;
663+ uint32_t type;
669664 char name[];
670665 };
671666
672667 #define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name)
673−#define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1))
668+#define FUSE_DIRENT_ALIGN(x) \
669+ (((x) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t) - 1))
674670 #define FUSE_DIRENT_SIZE(d) \
675671 FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)
676672
@@ -685,47 +681,47 @@ struct fuse_direntplus { · 8 unmodified lines
685681 FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET_DIRENTPLUS + (d)->dirent.namelen)
686682
687683 struct fuse_notify_inval_inode_out {
688− __u64 ino;
689− __s64 off;
690− __s64 len;
684+ uint64_t ino;
685+ int64_t off;
686+ int64_t len;
691687 };
692688
693689 struct fuse_notify_inval_entry_out {
694− __u64 parent;
695− __u32 namelen;
696− __u32 padding;
690+ uint64_t parent;
691+ uint32_t namelen;
692+ uint32_t padding;
697693 };
698694
699695 struct fuse_notify_delete_out {
700− __u64 parent;
701− __u64 child;
702− __u32 namelen;
703− __u32 padding;
696+ uint64_t parent;
697+ uint64_t child;
698+ uint32_t namelen;
699+ uint32_t padding;
704700 };
705701
706702 struct fuse_notify_store_out {
707− __u64 nodeid;
708− __u64 offset;
709− __u32 size;
710− __u32 padding;
703+ uint64_t nodeid;
704+ uint64_t offset;
705+ uint32_t size;
706+ uint32_t padding;
711707 };
712708
713709 struct fuse_notify_retrieve_out {
714− __u64 notify_unique;
715− __u64 nodeid;
716− __u64 offset;
717− __u32 size;
718− __u32 padding;
710+ uint64_t notify_unique;
711+ uint64_t nodeid;
712+ uint64_t offset;
713+ uint32_t size;
714+ uint32_t padding;
719715 };
720716
721717 /* Matches the size of fuse_write_in */
722718 struct fuse_notify_retrieve_in {
723− __u64 dummy1;
724− __u64 offset;
725− __u32 size;
726− __u32 dummy2;
727− __u64 dummy3;
728− __u64 dummy4;
719+ uint64_t dummy1;
720+ uint64_t offset;
721+ uint32_t size;
722+ uint32_t dummy2;
723+ uint64_t dummy3;
724+ uint64_t dummy4;
729725 };
730726
731727 #endif /* _LINUX_FUSE_H */