Read ath10k driver variable in mac80211 - linux-kernel

I added a variable in ath10k driver, i want to read it in mac80211. What is the safest way to do it?
Can i put it in the skb for exemple ?

Related

How do I assign a name to a v8::Object so that scripts can access it?

I'm currently trying to add scripting functionality to my C++ application by using v8. The goal is to process some data in buffers with JS and then return the result. I think I can generate an ArrayBuffer by using New with an appropriate BackingStore. The result would be a Local. I would now like to run scripts via v8::Script::Compile and v8::Script::Run. What would be the name of the ArrayBuffer - or how can I assign it a name so that it's accessible in the script? Do I need to make it a Globalif I need to run multiple scripts on the same ArrayBuffer?
If you want scripts to be able to access, say, my_array_buffer, then you'll have to install the ArrayBuffer as a property on the global object. See https://v8.dev/docs/embed for an introduction to embedding V8, and the additional examples linked from there. In short, it'll boil down to something like:
global_object->Set(context,
v8::String::NewFromUtf8(isolate, "my_array_buffer"),
array_buffer);
You don't need to store the ArrayBuffer in a Global for this to work.

Can i find out symbolic link of opened device, when process IRP_MJ_READ?

I have driver, that construct and return some data on IRP_MJ_READ request.
I use some symbolic link to open and read device, associated with driver.
The symbolic link is something like \\DosDevice\\Name1.
I want to use same device to get another data from same driver.
How can driver determine, which type of data it would return?
I think, if this is some way to use another symbolic link (for example: \\DosDevice\\Name2) to the same device for split requests for first type of data and requests for second type?
Else if this another way, to pass some identifying information together with thre IRP_MJ_READ?
no, you can not determinate which symbolic links used and are it used at all for open file on your device. and you not need try do this at all. this is wrong way.
when user open file on your device it specify some file name. and you can and must use this name - based on it - return different content on IRP_MJ_READ.
say your device named as \Device\MyDevice. user can open file, for example, with next names : "\Device\MyDevice", "\Device\MyDevice\" "\Device\MyDevice\Name1", "\Device\MyDevice\Name2". as result you, in your IRP_MJ_CREATE will be view next FileObject names : "", "\","\Name1","\Name2" and you, base on file name, can associate different context with file object and then use this context in IRP_MJ_READ and another points. also user can pass additional information on create by using Extended Attributes (EA) and AllocationSize
and as general note - for what use symbolic links to device at all ? why not open it direct by name ? and use IRP_MJ_READ exist sense only if you can handle this request asynchronous or pass IRP to lower driver. in case, if you always synchronous complete request - much more better use FastIoRead handler
also instead on handle read request based on file name, you can use parameters: are you using ByteOffset now ? if not you can use it for distinguish. if you use ByteOffset now, are Key parameter in use ? almost sure that no. in this case you can for Key==0 return some data, for Key==1, some another data, and so on. for use Key you need use NtReadFile instead of ReadFile in user mode.
also you can use IOCTL instead read file for return data, etc. without more knowledge about your driver and it communication with user mode hard say which is better. but formal answer - you can and need use FileName for distinguish which data need return on read

Latency using struct bio

I want to draw latency information for each struct bio that passes through the block layer. I have a module that overrides make_request_fn. I would want to find out how long did that bio took from there to reach request queue and from there to driver and so on.
I tried to attach a custom struct to the bio I receive at make_request_fn but since I did not create those, I cant use the bi_private field. Is there any way to work around this?
One option I have is to make a bio wrapper structure and copy bio structs into it before passing it to the lower functions so that I could use container_of to record times.
I have read about tools like blktrace and btt but I need that information inside my module. Is there any way to achieve this?
Thank you.
The solution I used seemed like a common workaround once I found something similar in the source of drbd block driver. The bi_private field can be used only by the function that allocates it. So I used bio_clone in the following way
bio_copy = bio_clone(bio_source, GFP_NOIO);
struct something *instance = kmalloc(sizeof(struct something), GFP_KERNEL);
instance->bio_original = bio_source;
//update timestamps for latency inside this struct instance
bio_copy->bi_private = instance;
bio_copy->bi_end_io = my_end_io_function;
bio_copy->bi_dev = bio_source->bi_dev;
...
...
make_request_fn(queue, bio_copy);
You'll have to write a bi_end_io function. Do remember to call bio_endio for original bio inside this function. You might need to copy bi_error field into bio_source's bi_error before calling bio_endio(bio_source).
Hope this helps someone.

Using DiskVolumeInfo (Cluster Failover API)

I found the DiskVolumeInfo property -- I'd like to use it to get some disk information in a clustered setup.
http://msdn.microsoft.com/en-us/library/windows/desktop/bb309235(v=vs.85).aspx
The problem is I have no idea what technology is required to get this data. This doesn't resemble the standard C/C++/C#/VB format of function/method reference.
Question: How do I get the DiskVolumeInfo data?
Ideally I could write the binary output directly to a file, say data.bin.
Any ideas would be helpful, thanks.
The process for getting object properties is described here.
Looks like you need to call the ClusterResourceControl function with a handle to the physical disk resource and the CLUSCTL_RESOURCE_GET_PRIVATE_PROPERTIES control code. You can then use ResUtilFindBinaryProperty to extract the DiskVolumeInfo property from the property list returned.
For anyone still interested:
As given here CLUSCTL_RESOURCE_STORAGE_GET_DISK_INFO_EX is a better way to do this.

What is "adapter name"?

WinAPI's GetAdaptersInfo() fills structure AdapterInfo which has field called AdapterName. What does this field mean? What's the point in it? In my case it holds string "{C01E7744-531D-401F-8EA6-D76D3AF35555}" (including curly braces).
P.S.: beside AdapterName there is pretty clear (for me) field called Description with value (in my case):
"Realtek RTL8102E/RTL8103E Family PCI-E Fast Ethernet NIC - VirtualBox Host Interface Networking Driver Miniport"
what makes me even more confused with AdapterName.
Looks like it's just a GUID that windows assigns to the adapter, probably as a unique identifier that you can use in some other API call to reference that adapter specifically. For example GetAdapterIndex.
Most IP helper functions seem to take an adapter index, but if you had an app that manipulated network adapters, you probably wouldn't want to store the index of a specific adapter in your app as that could change when adapters are added or removed. So you would store the name of the adapter, then use GetAdapterIndex to get the index for it when needed.
Its formatted like so
GetAdapterIndex(L"\\device\\tcpip_{FD2046B5-1DA0-40A2-9F28-DE4D6F0EBE22}", &index);
I have no idea where this is actually documented officially but found it sourced here: https://chromium.googlesource.com/external/qemu/+/refs/heads/master/qga/commands-win32.c
Description is the user-friendly name associated with AdapterName.
Sources:
http://www.delphigroups.info/2/8/215347.html

Resources