Diff

Differences From Artifact [395d853f2a]:

To Artifact [741721e332]:


270
271
272
273
274
275
276
277
278




















279
280
281
282
283
284
285
...
323
324
325
326
327
328
329




330
331
332
333
334
335
336
		uplevel 1 [list set line $line]
		uplevel 1 $code
	}
	uplevel 1 [list unset -nocomplain line]
}

proc ::tuapi::modprobe args {
	# Load aliases
	set modules_dir [file join /lib/modules $::tcl_platform(osVersion)]




















	set aliases_file [file join $modules_dir modules.alias]
	set fd [open $aliases_file]
	::tuapi::internal::foreach_line $fd " " {
		set alias [lindex $line 1]
		set module [lindex $line 2]

		set alias2module($alias) $module
................................................................................
			} else {
				set load [list]
			}

			lappend load $module

			foreach module $load {




				set module [file join $modules_dir $module]

				::tuapi::syscall::insmod $module
			}
		}
	}
}







|

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>







270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
...
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
		uplevel 1 [list set line $line]
		uplevel 1 $code
	}
	uplevel 1 [list unset -nocomplain line]
}

proc ::tuapi::modprobe args {
	# Set module base directory
	set modules_dir [file join /lib/modules $::tcl_platform(osVersion)]

	# Load device names
	set devnames_file [file join $modules_dir modules.devname]
	set fd [open $devnames_file]
	::tuapi::internal::foreach_line $fd " " {
		set module [lindex $line 0]
		set device [lindex $line 1]
		set id [lindex $line 2]

		set id_type [string index $id 0]
		set id_type [string map [list "c" "char" "b" "block"] $id_type]
		set id [split [string range $id 1 end] :]
		set id_alias "${id_type}-major-[lindex $id 0]-[lindex $id 1]"

		set "alias2module(/dev/${device})" $module
		set alias2module($id_alias) $module
	}
	close $fd

	# Load aliases
	set aliases_file [file join $modules_dir modules.alias]
	set fd [open $aliases_file]
	::tuapi::internal::foreach_line $fd " " {
		set alias [lindex $line 1]
		set module [lindex $line 2]

		set alias2module($alias) $module
................................................................................
			} else {
				set load [list]
			}

			lappend load $module

			foreach module $load {
				if {[string match "/dev/*" $module]} {
					return -code error "Unable to lookup device node module for $module"
				}

				set module [file join $modules_dir $module]

				::tuapi::syscall::insmod $module
			}
		}
	}
}