This file is indexed.

/usr/share/pyshared/tcm_ramdisk.py is in lio-utils 3.1+git2.fd0b34fd-2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/python

import os
import subprocess as sub
import string, re
from optparse import OptionParser

tcm_root = "/sys/kernel/config/target/core"

def createvirtdev(path, params):
	
#	print "Calling ramdisk createvirtdev: path " + path
	cfs_path = tcm_root + "/" + path + "/"
#	print "Calling ramdisk createvirtdev: params " + str(params)
	rd_pages = params[0]

	rd_params = "rd_pages=" + rd_pages
#	print "rd_params: " + rd_params

	control_opt = "echo -n " + rd_params.rstrip() + " > " + cfs_path + "/control"
#	print "control_opt: " + control_opt
	ret = os.system(control_opt)
	if ret:
		print "RAMDISK: createvirtdev failed for control_opt with " + rd_params
		return -1

	enable_opt = "echo 1 > " +  cfs_path + "enable"	
#	print "Calling enable_opt " + enable_opt
	ret = os.system(enable_opt)
	if ret:
		print "RAMDISK: createvirtdev failed for enable_opt with " + rd_params
		return -1

def rd_freevirtdev():
	pass

def rd_get_params(path):

	info_file = path + "/info"
	p = open(info_file, 'rU')
	try:
		value = p.read(1024)
	except IOError, msg:
		p.close()
		return
	p.close()

	off = value.index('PAGE_SIZE: ')
	off += 11 # Skip over "PAGE_SIZE: "
	rd_pages_tmp = value[off:]
	rd_pages = rd_pages_tmp.split('*')
	params = "rd_pages=" + rd_pages[0]

	# rd_pages= parameter for tcm_node --createdev
	return rd_pages[0]