@@ -294,6 +294,7 @@ static inline void fsnotify_group_assert_locked(struct fsnotify_group *group)
294
294
/* When calling fsnotify tell it if the data is a path or inode */
295
295
enum fsnotify_data_type {
296
296
FSNOTIFY_EVENT_NONE ,
297
+ FSNOTIFY_EVENT_FILE_RANGE ,
297
298
FSNOTIFY_EVENT_PATH ,
298
299
FSNOTIFY_EVENT_INODE ,
299
300
FSNOTIFY_EVENT_DENTRY ,
@@ -306,6 +307,17 @@ struct fs_error_report {
306
307
struct super_block * sb ;
307
308
};
308
309
310
+ struct file_range {
311
+ const struct path * path ;
312
+ loff_t pos ;
313
+ size_t count ;
314
+ };
315
+
316
+ static inline const struct path * file_range_path (const struct file_range * range )
317
+ {
318
+ return range -> path ;
319
+ }
320
+
309
321
static inline struct inode * fsnotify_data_inode (const void * data , int data_type )
310
322
{
311
323
switch (data_type ) {
@@ -315,6 +327,8 @@ static inline struct inode *fsnotify_data_inode(const void *data, int data_type)
315
327
return d_inode (data );
316
328
case FSNOTIFY_EVENT_PATH :
317
329
return d_inode (((const struct path * )data )-> dentry );
330
+ case FSNOTIFY_EVENT_FILE_RANGE :
331
+ return d_inode (file_range_path (data )-> dentry );
318
332
case FSNOTIFY_EVENT_ERROR :
319
333
return ((struct fs_error_report * )data )-> inode ;
320
334
default :
@@ -330,6 +344,8 @@ static inline struct dentry *fsnotify_data_dentry(const void *data, int data_typ
330
344
return (struct dentry * )data ;
331
345
case FSNOTIFY_EVENT_PATH :
332
346
return ((const struct path * )data )-> dentry ;
347
+ case FSNOTIFY_EVENT_FILE_RANGE :
348
+ return file_range_path (data )-> dentry ;
333
349
default :
334
350
return NULL ;
335
351
}
@@ -341,6 +357,8 @@ static inline const struct path *fsnotify_data_path(const void *data,
341
357
switch (data_type ) {
342
358
case FSNOTIFY_EVENT_PATH :
343
359
return data ;
360
+ case FSNOTIFY_EVENT_FILE_RANGE :
361
+ return file_range_path (data );
344
362
default :
345
363
return NULL ;
346
364
}
@@ -356,6 +374,8 @@ static inline struct super_block *fsnotify_data_sb(const void *data,
356
374
return ((struct dentry * )data )-> d_sb ;
357
375
case FSNOTIFY_EVENT_PATH :
358
376
return ((const struct path * )data )-> dentry -> d_sb ;
377
+ case FSNOTIFY_EVENT_FILE_RANGE :
378
+ return file_range_path (data )-> dentry -> d_sb ;
359
379
case FSNOTIFY_EVENT_ERROR :
360
380
return ((struct fs_error_report * ) data )-> sb ;
361
381
default :
@@ -375,6 +395,18 @@ static inline struct fs_error_report *fsnotify_data_error_report(
375
395
}
376
396
}
377
397
398
+ static inline const struct file_range * fsnotify_data_file_range (
399
+ const void * data ,
400
+ int data_type )
401
+ {
402
+ switch (data_type ) {
403
+ case FSNOTIFY_EVENT_FILE_RANGE :
404
+ return (struct file_range * )data ;
405
+ default :
406
+ return NULL ;
407
+ }
408
+ }
409
+
378
410
/*
379
411
* Index to merged marks iterator array that correlates to a type of watch.
380
412
* The type of watched object can be deduced from the iterator type, but not
@@ -863,9 +895,17 @@ static inline void fsnotify_init_event(struct fsnotify_event *event)
863
895
{
864
896
INIT_LIST_HEAD (& event -> list );
865
897
}
898
+ int fsnotify_pre_content (const struct path * path , const loff_t * ppos ,
899
+ size_t count );
866
900
867
901
#else
868
902
903
+ static inline int fsnotify_pre_content (const struct path * path ,
904
+ const loff_t * ppos , size_t count )
905
+ {
906
+ return 0 ;
907
+ }
908
+
869
909
static inline int fsnotify (__u32 mask , const void * data , int data_type ,
870
910
struct inode * dir , const struct qstr * name ,
871
911
struct inode * inode , u32 cookie )
0 commit comments