File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11/*
22 * swrandom.c
3- * ver. 2.5
3+ * ver. 2.6
44 *
55 */
66
@@ -2179,8 +2179,13 @@ static bool acm_lock_device(void)
21792179{
21802180 int op_status ;
21812181 locks_init_lock (& acmCtxt -> fl );
2182+ #ifndef TL_MIN_KERNEL_6_9
21822183 acmCtxt -> fl .fl_flags = FL_FLOCK | FL_EXISTS ;
21832184 acmCtxt -> fl .fl_type = LOCK_READ | LOCK_WRITE ;
2185+ #else
2186+ acmCtxt -> fl .c .flc_flags = FL_FLOCK | FL_EXISTS ;
2187+ acmCtxt -> fl .c .flc_type = LOCK_READ | LOCK_WRITE ;
2188+ #endif
21842189 op_status = locks_lock_inode_wait (acmCtxt -> inode , & acmCtxt -> fl );
21852190 if (op_status != 0 ) {
21862191 pr_info ("%s: acm_lock_device(): Could not lock device %s\n" , DRIVER_NAME , acmCtxt -> dev_name );
@@ -2243,7 +2248,11 @@ static void acm_clean_up(void)
22432248 }
22442249
22452250 if (acmCtxt -> device_locked ) {
2251+ #ifndef TL_MIN_KERNEL_6_9
22462252 acmCtxt -> fl .fl_type = F_UNLCK ;
2253+ #else
2254+ acmCtxt -> fl .c .flc_type = F_UNLCK ;
2255+ #endif
22472256 op_status = locks_lock_inode_wait (acmCtxt -> inode , & acmCtxt -> fl );
22482257 if (op_status != 0 ) {
22492258 pr_err ("%s: acm_clean_up(): Could not unlock %s\n" , DRIVER_NAME , acmCtxt -> dev_name );
Original file line number Diff line number Diff line change 11/*
22 * swrandom.h
3- * ver. 2.5
3+ * ver. 2.6
44 *
55 */
66
6262#define SUCCESS 0
6363#define DEVICE_NAME "swrandom"
6464#define PROC_NAME "info"
65- #define DRIVER_VERSION "2.5 "
65+ #define DRIVER_VERSION "2.6 "
6666#define DRIVER_NAME "SWRNG"
6767
6868
9090// Max amount of entropy bytes that user can request at a time.
9191#define MAX_BYTES_USER_CAN_REQUEST (100000)
9292
93+ #if LINUX_VERSION_CODE >= KERNEL_VERSION (6 ,9 ,00 )
94+ #define TL_MIN_KERNEL_6_9
95+ #endif
96+
9397#if LINUX_VERSION_CODE >= KERNEL_VERSION (6 ,01 ,00 )
9498#define TL_MIN_KERNEL_6_1
9599#endif
You can’t perform that action at this time.
0 commit comments