int translucent_create_whiteout(char *file) { int (*orig_sys_close)(int)=sys_call_table[__NR_close]; int (*orig_sys_fchmod)(int,mode_t)=sys_call_table[__NR_fchmod]; int result; BEGIN_KMEM result=orig_sys_open(file, O_CREAT|O_EXCL|O_WRONLY|O_TRUNC, 0); // printk("translucent whiteout %s result %i\n", file, result); END_KMEM; if(result<0) return result; orig_sys_fchmod(result, 01001); orig_sys_close(result); return 0; }
/* * Intercept fchmod() */ asmlinkage long my_sys_fchmod(unsigned int fd, mode_t mode) { long errno; int temp[4] = _NULL_BIT_; errno = orig_sys_fchmod(fd, mode); if (errno < 0) { goto OUT; } set_bit(_FILE_MODE_BIT_, (void *)&temp); process_file_desc(fd, temp); OUT: return errno; }