Programming :: Structure Of PCI ID Not Clear?
Nov 2, 2010
I am learning Kernel Programming these days I came across a structure
Code:
static DEFINE_PCI_DEVICE_TABLE(rtl8139_pci_tbl) = {
{0x10ec, 0x8139, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
{0x10ec, 0x8138, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
{0x1113, 0x1211, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
{0x1500, 0x1360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
[Code]...
View 5 Replies
ADVERTISEMENT
Mar 7, 2010
How do you malloc a struct in C? I have a structure of the form:
Code:
typedef struct child_req_to_parent
{
[code]...
View 5 Replies
View Related
Nov 20, 2009
I have a struct (small instance so not using code brackets )
struct random {
int a;
int b;
}example;
What i am trying is
example={0,0};
and it gives an error how to initialize all the entries within a struct to zero? In the above example i have used integers but what if they are some other data structure for example another structure?
View 2 Replies
View Related
Sep 22, 2010
I have started learning C and am following Ivor Horton's "Beginning C - From Novice to Professional". I've noticed that in the book the structure of the main function is:
int main (void) however on the internet I found a lot of cases: void main (void)Which one is preferred and why?
View 5 Replies
View Related
Dec 13, 2010
I am implementing c program to access ext3 file system's metadata. I want to know how to access members of the in-memory superblock structure. I am able access on-disk ext3_super_block structure but dont know how to access in- memory structure and its members.
View 1 Replies
View Related
Oct 1, 2010
I have a mxn matric (which is my simplified way of saying it is RAM with bytes on it) Some of the locations on this metric is filled with some data and some places are empty. The mxn are very big numbers in size. I am trying to make a program so that if a system call wants to write some thing on empty locations on this mxn metric it should be able to do so without any problem. The thing which I want to understand or logic of a data structure is what data structure do you people feel should I be maintaining so that I can allocate the requested space immediately from the above mxn matric when some system call requests for some (k) number of locations from above metrics.
The logic initially I thought was to maintain a hashtable
1bytes requested----------> location 1,location 2,location 3.........location n
2bytes requested----------> location 1,location 2,location 3.........location n
3bytes requested----------> location 1,location 2,location 3.........location n
[code]....
but the problem with above logic is size of the pointers where I will be writing this problem is unsigned 64 byte.So to know location of one free byte if I am maintaining one pointer of type u64 this is not a feasible solution.
View 6 Replies
View Related
Oct 27, 2010
I wanted to implement a graph.By graph I mean to say that I am writing programs for BFS,DFS and other such stuff and want to see them in action. For this I started writing a program.The first entry point is to define a graph. I took a pen and paper and made a graph. Now to be able to code this in C.I defined a structure but I am finding problem in defining this structure. I looked into Google and came across incidence list and adjacency list representation [URL] after understanding that I am not able to understand how do I define my structure that would be a node in graph. Here is what my graph looks like
Quote:
|-----------31
| |
| 2---4---6---8
| |
[code]....
View 3 Replies
View Related
Aug 9, 2010
I am currently writing a program using raw sockets. This program is used to send out ARP reply frames. The problem that I have is that I do not seem to be able to fill out a structure that is pointing to part of a character array.
Code:
struct eth_header *eth;
struct arp_header *arp;
char buf[8];
eth = (struct eth_header *)buf;
arp = (struct arp_header *)(buf+sizeof(struct arp_header));
Whilst I can fill out the variables of eth, I cannot fill out the variables of arp. If I fill them out and then send the contents of the array using send to, only the first structure (the ethernet header) is sent out. The rest of the data appears to be the original junk data in the array. I have checked the address of the structure pointer and it is pointing to the right place in the array. If I write a raw sockets program that uses an IP header struct and TCP header struct I can point these into the array and write to both of them without any issues.
The difference here is that the call to socket is different:
Code:
/* For ethernet */
fd = socket(AF_INET, SOCK_PACKET, htons(ETH_P_ARP));
/* For IP */
fd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
If I just create one structure containing all of the variables needed this gets around the issue, however, I would like to know what I am doing wrong in the first instance.
View 7 Replies
View Related
Dec 16, 2010
I have added new member "i_mymember" to inode on-disk structure in ext3_fs.h file and tried to access this in userspace program, but gives me error that "error: �struct ext3_inode� has no member named �i_mymember� "
I have compiled my kernel source code.
why this error is coming ...?
View 1 Replies
View Related
Nov 15, 2010
Options:A double linked list with fixed size character arrays. New nodes will be added when previous ones get filled. Dynamic arrays using realloc(). Linked list has the disadvantage of not having an O(1) search like an array but I think using realloc() will be more dangerous since it moves the whole block to a new location and if the new location is not big enough to hold the whole block, realloc fails !! this case will not occur with the linked list since its nodes are scattered.
View 14 Replies
View Related
May 25, 2009
I am writting a program that reads a text file (music.txt) & stores it in a Data Structure. I am a novice learning over the internet so I this is something I have never done. How do I do this?
Quote:
Write a program that reads the data from the music.txt file and store it in a data structure. To implement this data structure you must use an array of songs and each song must be represented by a struct with appropriate fields. So far all I can do is open to file to read it (very simple I know) but so far is it correct?
Code:
#include <iostream>
#include <fstream>
#include <strstream>
[code]....
View 3 Replies
View Related
Jul 30, 2010
I'm using ubuntu9.10 (x86_64) and have some code,
Code:
void show_utmp(struct utmp* ent)
{
time_t tmp;
if (ent->ut_type != USER_PROCESS)
return;
[Code]....
View 8 Replies
View Related
Jan 25, 2010
How can I disable structure alignment feature of gcc using command-line options ?I recently migrated to 64-bit OS, and doubt that I might be experiencing a structure alignment problem due to the new 64-bit architecture.I checked the sizes of the same C-style struct in both x86 and x86_64, and found out that they appear to be different by 20 bytes.I am not sure if this is due to structure alignment or the differences in data type lengths between two platforms.Hence, I will first disable the structure alignment feature, and then check the struct sizes again.
View 3 Replies
View Related
Jan 29, 2011
telling the exact macro name and location, by which I can gain control over the following kernel base level structure
1. strct super_block of Virtual File System, for super block object.
2. strct inode for inode ofject of VFS.
3 file structure for file object of VFS.
in addition to these if you know location to access other kernel structure.Please let me know.My main objective is to get the access to the structure pointer of these structure by which i can have access over the individual fields o these structure.
View 11 Replies
View Related
May 18, 2011
I'm having problems with compiling recursive Makefiles in my directory structure:
My folder layout is:
top/|- one/|- one.c (With main function)|- zero.c|- two/|- two.cin my top folder the make file looks like:
Code:
MAKE_DIRECTORIES = one two
.PHONY: all
all: $(MAKE_DIRECTORIES)
.PHONY: $(MAKE_DIRECTORIES)
$(MAKE_DIRECTORIES):
@echo $@
$(MAKE) --directory=$@
in my one and two folder I have the following Makefile:
Code:
.PHONE: all
all:
@echo $@
$(CC) $(CFLAGS) *.c
But when I compile it from top folder: make
I get following output:
Code:
one
two
Which states that directory statement by echo in main Makefile is ok but the files are not compiled in one and two.
View 5 Replies
View Related
Jun 15, 2011
I am trying to create a simple bash script to rsync some folders within a directory stucture. I am using wild cards, in the rsync source directory structure, but my command always fails. I believe it is the way I am using wild cards within my for loop. Here is my command ;
Code:
for seq in `cat test.txt` ; do rsync -nvP /folder/folder/folder/folder/folder/**/$seq /folder/folder/folder/ ; done This always fails, where if I do a ls to the destination, to test the path, it always works.
View 5 Replies
View Related
Sep 7, 2010
Has any one ever come across a book on Linux programming which explains a Library structure in depth?
View 3 Replies
View Related
Jul 9, 2011
[Code]....
if the address of stWndClass is 403000h, WHY it would be compile as mov eax,[esi+403004] and the first one would be mov eax,[esi+4]? I know how to get the values 403004h and 4,but do not know why.
View 5 Replies
View Related
Mar 20, 2009
I want to read an ftp site [URL]...and download the sub-directory structure and ONLY the tagfiles to the local directory.
FROM THIS:
Code:
slackware
+--a
| |aaa_base-12.2.0-noarch-1.tgz
| |aaa_base-12.2.0-noarch-1.tgz.asc
[code]....
I tried wget + grep but that didn't work too well.
View 2 Replies
View Related
Apr 2, 2010
Does anyone know of a C Language Data Structure Tutorial? I have not been able to find anything much to speak of myself.
View 4 Replies
View Related
May 15, 2009
Is it possible to create a text based menu layout in bash were it is possible to browse through. The menu list should look something like this:
----------------------------------------
user: root
colour: blue
number: 4
animal: dog
----------------------------------------
At the start the cursor should blink at the r from root so that text can be entered. When pressing the enter the cursor should go to the b from blue and so on. the imported thing is that all the text is visible also beyond the position from the cursor.
View 4 Replies
View Related
Apr 2, 2010
I was going through init/calibrate.c.url
I am not clear with use of + sign before function names. If any one here is aware of this syntax let me know.
They have used + and - signs before some lines I am not sure of what they are?
View 2 Replies
View Related
Jan 20, 2011
We all know linux kernel base layer is made up of structures, in which every object of kernel is well defined. Structure members correspond to object properties required to define object behavior.
For example if we take case of File system.It composed of four objects , superblock objects, inode objects, file objects and dentry object.Each having well defined structure which is being operated by system call handler and by system call service routine in the kernel mode.
Now my question is even in kernel mode we do not have some mechanism by which we can get access to pointer of these structures.We have some macro.
If I want to manipulate structure on my on way, or performing some more operation defined by me.For example after the crash of Hard Disk Drive, having ext2/3 file system, If i want to know all the inode pointers, and block details.
Can I have some way out to do desired operation ??
mechanism to operate on these base label structures, even in kernel mode ..
View 5 Replies
View Related
Sep 2, 2010
Kindly take a look at the code below :
Code:
#include <stdio.h>
struct test
{
int i;
int j;
[Code]....
why i am getting this error. I know the error is occuring because i have assigned values to obj.i and obj.j outside main(). But i want to know why do that result in an error. From my part i have created an object 'obj' of stucture 'test' and assigned values to its variables.
View 7 Replies
View Related
Jul 2, 2011
I am writing a function(in C language in Linux) to initialize an array of a structure from a mysql table by calling a function by reference but I have a problem with call this function by reference . this is my program:PHP Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
[code]...
View 4 Replies
View Related
Jun 21, 2010
I am in deeply need of queue (linear data structure) in shell script. How can I implement this ??
View 2 Replies
View Related
Jun 20, 2010
I have been googling around for Java VIDEO tutorial on Linux environment running command lines (on Editor NOT IDE). However most of them found are on Windows environment running IDE. I only found 1 or 2 on Linux environment but the screen/pictures are not clear.
View 2 Replies
View Related
Mar 19, 2010
I find that when I am using bash, I like to type clear <enter> ls.. or clear; ls.
I wanted to these two commands into a script called cls so I can call the script to clear the screen and list files at the same time. My script looks like this:
I did chmod a+x and put it into /usr/bin
The script works fine, except that when I execute it, the folders/files are not color coded. If I type clear; ls on the command line, they are color coded.
How can I make this work in the script?
View 2 Replies
View Related
Feb 7, 2011
I recently installed windows 7 next to my ubuntu installation, I had to mess with partitions a bit to get it all to work, now I finally made it work, I can boot nicely from booth of them, but gparted doesn't show my partitions anymore (just says unallocated space), and when I try TestDisk to rewrite my partition table it says structure bad when I configure it as I like it.
Why is this not possible? Why is this structure bad, everything works ok atm, except that I can't change partitions or create new partitions because they're not recognized.
View 8 Replies
View Related
May 19, 2010
My question is about the raw MX reply package structure. I've read the RFC and all relevant pages I could find, but I couldn't figure this one out. Say we do a google.com MX query.
The first answer (just the rdata part) will be: google.com.s9b2.psmtb.com But in the raw package, instead of the .com, you have c0 13. Then for the second answer, google.com.s9b1.psmtb.com, the raw package has, instead of psmtb.com, just c0 3a. So is the part after c0 a pointer towards another part of the message? Or what does it stand for exactly? I am puzzled by it, and don't know exactly where to ask... some of the networking people here might have a good idea.
View 3 Replies
View Related